﻿// -----------------------------------------------------------------------
// <copyright file="SearchLogic.cs" company="Abyssalsoft">
// TODO: Update copyright text.
// </copyright>
// -----------------------------------------------------------------------

namespace Metal.Player.Playlist
{
    using System;
    using System.Collections.Generic;
    using System.Text;

    /// <summary>
    /// TODO: Update summary.
    /// </summary>
    public class SearchLogic
    {
        #region Members

        /// <summary> Stores reference to our instance </summary>
        private static SearchLogic instance = null;

        #endregion

        #region Constructor

        /// <summary> Gets the current instance of this class </summary>
        public static SearchLogic Instance
        {
            get
            {
                if (instance == null)
                {
                    instance = new SearchLogic();
                }

                return instance;
            }
        }

        #endregion

        #region Methods called by reflection

        /// <summary>
        /// Play selected file
        /// </summary>
        public void AddToQueue()
        {
            try
            {
                QueueController.AddFileToQueue(SearchController.View.ListSelectedRow);
            }
            catch (Exception ex)
            {
                Metal.User.UserMessage.ShowError(ex);
            }
        }

        /// <summary>
        /// Show file information form (ID3 Tags and MPEG info)
        /// </summary>
        public void OpenFileInfo()
        {
            try
            {
                PlaylistLogic.Instance.OpenFileInfo();
            }
            catch (Exception ex)
            {
                Metal.User.UserMessage.ShowError(ex);
            }
        }

        #endregion
    }
}
